import { Status } from '@/api/statusInfo'

const options = [
  { value: 'ENABLE',label: '开启' },
  { value: 'DISABLE',label: '关闭' }
]
export default {
  data(){
    return {
      mx_tabSelect:[] // tab已选
    }
  },
  created(){
  },
  methods: {
    // 状态设置
    switchChange(row,item) {
      const $class = new Status();  //创建类
      $class.setApi(item.api)   //设置api
      // 后端
      if (row.status === 'ENABLE') {
        $class.stop(row.id,item.postType).then((res) => {
          this.$Tip(res)
        })
      } else if (row.status === 'DISABLE') {
        $class.enable(row.id,item.postType).then((res) => {
          this.$Tip(res)
        })
      }
      this.getList()
    },
    // table选项
    rowSelection(con) {
      this.mx_tabSelect = con
    },
    // 排序
    sortChange(sorter){
      const { field, order } = sorter
      this.queryParam.order_by = field
      this.queryParam.order_type = order === 'ascend' ? 'asc' : 'desc'
      this.handleFilter()
    },
    handleFilter(){
      this.queryParam.page = 1
      this.getList()
    },

  }
}